﻿using FluentNHibernate.Mapping;

namespace NMA.Infrastructure.NHibernate.Mapping
{
    using NMA.Infrastructure.NHibernate.DomainObject;
    using NMA.Domain.Model;

    public class PollMap : ClassMap<Poll>
    {
        public PollMap()
        {
            Table("[NMA].[dbo].[Poll]");
            Id(x => x.Id, "ID").GeneratedBy.Guid();            
            Map(x => x.Name, "Name").Not.Nullable();
            Map(x => x.Value, "Value");
            Map(x => x.VoteDate, "VoteDate");
            Map(x => x.WhoVote, "WhoVote").Length(30);
            Map(x => x.CreatedDate, "CreatedDate").Not.Nullable();
            Map(x => x.UpdatedDate, "UpdatedDate");
            Map(x => x.CreatedUser, "CreatedUser").Not.Nullable().Length(30);
            Map(x => x.UpdatedUser, "UpdatedUser").Length(30);
            //References<News>(x => x.News)
            //    .Unique()
            //    .Column("News_Id")
            //    .LazyLoad()
            //    .Cascade.None();            
        }
    }
}
